/*
 * Copyright 2019 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.kie.workbench.common.screens.server.management.model;

import org.jboss.errai.common.client.api.annotations.Portable;

@Portable
public class ProcessConfigModule {

    private RuntimeStrategy runtimeStrategy;
    private String kBase;
    private String kSession;

    public ProcessConfigModule() {
        super();
    }
    public ProcessConfigModule(RuntimeStrategy runtimeStrategy, String kBase, String kSession) {
        super();
        this.runtimeStrategy = runtimeStrategy;
        this.kBase = kBase;
        this.kSession = kSession;
    }

    public RuntimeStrategy getRuntimeStrategy() {
        return runtimeStrategy;
    }

    public void setRuntimeStrategy(RuntimeStrategy runtimeStrategy) {
        this.runtimeStrategy = runtimeStrategy;
    }

    public String getKBase() {
        return kBase;
    }

    public void setKBase(String kBase) {
        this.kBase = kBase;
    }

    public String getKSession() {
        return kSession;
    }

    public void setKSession(String kSession) {
        this.kSession = kSession;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        ProcessConfigModule that = (ProcessConfigModule) o;

        if (runtimeStrategy != null ? !runtimeStrategy.equals(that.runtimeStrategy) : that.runtimeStrategy != null) {
            return false;
        }
        if (kBase != null ? !kBase.equals(that.kBase) : that.kBase != null) {
            return false;
        }
        return kSession != null ? kSession.equals(that.kSession) : that.kSession == null;
    }

    @Override
    public int hashCode() {
        int result = runtimeStrategy != null ? runtimeStrategy.hashCode() : 0;
        result = 31 * result + (kBase != null ? kBase.hashCode() : 0);
        result = 31 * result + (kSession != null ? kSession.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "ProcessConfigModule{" +
                "runtimeStrategy=" + getRuntimeStrategy().toString() +
                ", kBase='" + getKBase() + '\'' +
                ", kSession='" + getKSession() + '\'' +
                '}';
    }
}
